<template>
  <div class="form-templates">
    <div class="item_label">
      <span class="label_required" v-if="data.params.required">*</span>
      <span class="label_title">{{ data.params.title }}</span>
    </div>
    <div class="item_tip" v-if="data.params.explain">{{ data.params.explain }}</div>
    <div class="item_content">
      <template v-if="data.type == 'img'">
        <div>
          <div class="img_box">
            <i class="el-sc-jia3"></i>
            <span>添加图片</span>
          </div>
        </div>
      </template>
      <template v-if="data.type == 'text'">
        <div><el-input :placeholder="data.params.tip" size="small"></el-input></div>
      </template>
      <template v-if="data.type == 'textarea'">
        <div><el-input :placeholder="data.params.tip" type="textarea"></el-input></div>
      </template>
      <template v-if="data.type == 'select'">
        <div>
          <div class="select_div">
            <span class="tip">{{ data.params.tip }}</span>
            <span class="el-sc-xia3"></span>
          </div>
          <!-- <el-select :placeholder="data.params.tip" style="width: 100%;" size="small"><el-option v-for="(item, i) in data.list" :label="item.label" :value="item.value"></el-option></el-select> -->
        </div>
      </template>
      <template v-if="data.type == 'radio'">
        <el-radio-group v-model="data.params.value">
          <el-radio v-for="(item, i) in data.list" :key='i' :label="item.value">{{ item.label }}</el-radio>
        </el-radio-group>
      </template>
      <template v-if="data.type == 'checkbox'">
        <el-checkbox-group v-model="data.params.value" ><el-checkbox :label="item.label" v-for="(item, i) in data.list" :key='i'></el-checkbox></el-checkbox-group>
      </template>
      <template v-if="data.type == 'address'">
        <div>
          <div class="select_div">
            <span class="tip">{{ data.params.tip }}</span>
            <span class="el-sc-xia3"></span>
          </div>
        </div>
      </template>
      <template v-if="data.type == 'datepicker'">
        <div class="select_div">
          <span class="tip">{{ data.params.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
        <!-- <el-date-picker style="width: 100%;" v-model="data.params.value" size="small" type="date" placeholder="选择日期"></el-date-picker> -->
      </template>
      <template v-if="data.type == 'date'">
        <div class="select_div">
          <span class="tip">{{ data.params.start.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
        <div class="select_div">
          <span class="tip">{{ data.params.end.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
      </template>
      <template v-if="data.type == 'card'">
        <div><el-input :placeholder="data.params.tip"></el-input></div>
      </template>
      <template v-if="data.type == 'time'">
        <div class="select_div">
          <span class="tip">{{ data.params.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
      </template>
      <template v-if="data.type == 'times'">
        <div class="select_div">
          <span class="tip">{{ data.params.start.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
        <div class="select_div">
          <span class="tip">{{ data.params.end.tip }}</span>
          <span class="el-sc-xia3"></span>
        </div>
      </template>
      <template v-if="data.type == 'mobile'">
        <div><el-input :placeholder="data.params.tip"></el-input></div>
      </template>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  props: {
    data: {
      type: Object,
      default: {}
    }
  }
};
</script>
<style lang="scss" scoped>
.form-templates {
  background: #ffffff;
  padding: 0 20px;
  padding-bottom: 20px;
  .el-checkbox {
    margin-bottom: 10px;
  }
  .item_label {
    display: flex;
    align-items: center;
    padding: 16px 0;
    .label_required {
      margin-left: 5px;
      margin-right: 10px;
      color: #de434f;
    }
  }
  .item_tip {
    font-size: 12px;
    line-height: 17px;
    padding-bottom: 18px;
    color: #969696;
    word-break: break-all;
  }

  .img_box {
    width: 60px;
    height: 60px;
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999999;
    flex-direction: column;
    i {
      font-size: 20px;
      margin-bottom: 6px;
    }
    span {
      font-size: 10px;
    }
  }
  .select_div {
    width: 100%;
    border: 1px solid #dcdfe6;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 13px;
  }
  .tip {
    color: #dcdfe6;
  }
}
</style>
